import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN'
import VCharts from 'v-charts'

import '@/styles/index.scss' // global css

import App from './App'
import router from './router/routers'
import permission from './components/permission'
import store from './store'
import VueQuillEditor from 'vue-quill-editor'
import ImgInputer from 'vue-img-inputer'

import '@/icons' // icon
// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import 'vue-img-inputer/dist/index.css'

import './router/index' // permission control

Vue.use(VCharts)
Vue.use(permission)
Vue.use(ElementUI, { locale })
Vue.use(VueQuillEditor, { placeholder: '请输入内容', })
Vue.component('ImgInputer', ImgInputer)
Vue.config.productionTip = false
require('babel-polyfill')

import { formatDate } from './utils/index'
Vue.filter('formatDate', function(value, pattern) {
  if (!value) return ''
  return formatDate(new Date(value), pattern)
})

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
